////////////////////////////////////////////////////////////////////////////////
// Filename: sprite.hpp
////////////////////////////////////////////////////////////////////////////////
#ifndef SPRITE_HPP_
#define SPRITE_HPP_

//////////////
// INCLUDES //
//////////////
#include "rectangle.hpp"
#include "texture2d.hpp"
#include "graphics.hpp"

////////////////////////////////////////////////////////////////////////////////
// Class name: Sprite
////////////////////////////////////////////////////////////////////////////////
class Sprite : public miv::IRenderble {
public:
	Sprite();
	~Sprite();

	bool Initialize(Vector2D* position, Graphics* graphics, WCHAR* filename, bool useAlpha);
	bool Initialize(Vector2D* position, Graphics* graphics, WCHAR* filename);
	void Shutdown();
	void Draw(Graphics* graphics);
	void SetActive(ID3D11DeviceContext* deviceContext);

	int GetVertexCount();
	int GetIndexCount();

	Vector2D* GetPosition();

	ID3D11ShaderResourceView* GetTexture();

	bool IsAlphaEnabled();

private:
	bool InitializeBuffers(ID3D11Device* device);
	void ShutdownBuffers();
	void DrawBuffers(Graphics* graphics);

	bool LoadTexture(ID3D11Device* device, WCHAR* filename);
	void ReleaseTexture();

	ID3D11Buffer* m_vertexBuffer;
	ID3D11Buffer* m_indexBuffer;
	int m_vertexCount, m_indexCount;
	unsigned int m_width, m_height;
	Texture2D* m_texture;
	Vector2D* m_position;
	bool m_alphaEnabled;
};

#endif
